<?php
class Company_model extends CI_Model {
	
	public function __construct() {
		$this->load->database();
	}
	
	public function insert($data) {
		$data['date_updated'] = date("d/m/y : H:i:s", time());
		$this->db->insert('users', $data);
	}
	
	public function edit($id, $data) {
		$this->db->where('id', $id);
		$this->db->update('users', $data); 
	}
	
	public function get_details() {
		$query = $this->db->query("SELECT * FROM users WHERE is_valid = 0");
		return $query->result_array();
	}
	
	public function is_valid($id) {
		$data = array('is_valid' => 1);
		$this->db->where('id', $id);
		$this->db->update('users', $data);
	}
	
	public function find_by_id($id) {
		$query = $this->db->query("SELECT * FROM users WHERE id = $id");
		return $query->result_array();
	}
	
	
}
?>